package com.mapper;

import com.bean.Course;
import org.apache.ibatis.annotations.Many;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

public interface CourseMapperByAnnotation {

    @Select("select * from t_course where cid=#{cid}")
    @Results({
            @Result(id = true,column = "cid",property = "cid"),
            @Result(column = "cname",property = "cname"),
            @Result(column = "credit",property = "credit"),
            @Result(column = "teacher",property = "teacher"),
            @Result(column = "cid",property = "studentBeans",
                    many = @Many(select = "com.mapper.StudentMapperByAnnotation.findStuByCid")),
    })
    public Course findStuForCourseByCid(int cid);
}
